Proper connect_port
[juce-lv2.git] / juce / source / extras / the jucer / src / ui / jucer_ComponentLayoutPanel.cpp
blob53945a6678b47f15dad0d9cb6f85e83ec2397d23
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #include "../jucer_Headers.h"
27 #include "jucer_ComponentLayoutPanel.h"
30 //==============================================================================
31 class LayoutPropsPanel : public Component,
32 public ChangeListener
34 public:
35 //==============================================================================
36 LayoutPropsPanel (JucerDocument& document_, ComponentLayout& layout_)
37 : document (document_),
38 layout (layout_)
40 layout.getSelectedSet().addChangeListener (this);
42 addAndMakeVisible (propsPanel = new PropertyPanel());
45 ~LayoutPropsPanel()
47 layout.getSelectedSet().removeChangeListener (this);
49 clear();
50 deleteAllChildren();
53 //==============================================================================
54 void resized()
56 propsPanel->setBounds (4, 4, getWidth() - 8, getHeight() - 8);
59 void changeListenerCallback (ChangeBroadcaster*)
61 updateList();
64 void clear()
66 propsPanel->clear();
69 void updateList()
71 clear();
73 if (layout.getSelectedSet().getNumSelected() == 1) // xxx need to cope with multiple
75 Component* comp = layout.getSelectedSet().getSelectedItem (0);
77 if (comp != 0)
79 ComponentTypeHandler* const type = ComponentTypeHandler::getHandlerFor (*comp);
81 if (type != 0)
82 type->addPropertiesToPropertyPanel (comp, document, *propsPanel);
87 private:
88 JucerDocument& document;
89 ComponentLayout& layout;
91 PropertyPanel* propsPanel;
92 bool editingGraphics;
96 //==============================================================================
97 ComponentLayoutPanel::ComponentLayoutPanel (JucerDocument& document_, ComponentLayout& layout_)
98 : EditingPanelBase (document_,
99 new LayoutPropsPanel (document_, layout_),
100 new ComponentLayoutEditor (document_, layout_)),
101 layout (layout_)
105 ComponentLayoutPanel::~ComponentLayoutPanel()
107 deleteAllChildren();
110 void ComponentLayoutPanel::updatePropertiesList()
112 ((LayoutPropsPanel*) propsPanel)->updateList();
115 const Rectangle<int> ComponentLayoutPanel::getComponentArea() const
117 return ((ComponentLayoutEditor*) editor)->getComponentArea();
120 const Image ComponentLayoutPanel::createComponentSnapshot() const
122 return ((ComponentLayoutEditor*) editor)->createComponentLayerSnapshot();